﻿@model UpdateStudent
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <link href="~/css/bootstrap.css" rel="stylesheet" />
    <script src="~/js/jquery-1.10.2.js"></script>
    <meta name="viewport" content="width=device-width" />
    <script type="text/javascript">
        $(function () {
            $('#btnUpdate').click(function () {
                //var name = $('#Name').val();
                var dataForm = $('#updateForm').serializeArray();     //这是什么
                $.ajax({
                    url: '/student/Update',  /*请求的路径，在这就是某一个action*/
                    type: 'post', /*提交方式为post提交*/
                    data: dataForm,
                    dataType: 'json', /*服务器给浏览器返回的数据的格式*/
                    success: function (e) {
                        //服务器成功处理请求后，在这里里面需要做的一些回应或者操作
                        if (e == 'ok') {
                            alert('成功');
                            window.location.href = '/student/list';
                        }
                        else {
                            alert('失败');
                        }
                    },
                    error: function () {
                        alert('网络异常');
                    }
                });
            });
        })
    </script>




    <title></title>
</head>
<body>
    <form id="updateForm">
        <div class="form-horizontal">
            <hr />
            <h2 style="margin-left:460px">修改学员信息</h2>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-3">
                    <input type="hidden" class="form-control" placeholder="编号" name="Id" id="Id" value="@Model.studet.Id" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-3">
                    <input type="text" class="form-control" placeholder="姓名" name="Name" id="Name" value="@Model.studet.Name" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-3">
                    <input type="text" class="form-control" placeholder="性别" name="Sex" id="Sex" value="@Model.studet.Sex" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-3">
                    <input type="text" class="form-control" placeholder="年龄" name="Age" value="@Model.studet.Age" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-3">
                    <input type="text" class="form-control" placeholder="手机号" name="Mobile" value="@Model.studet.Mobile" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-3">
                    <input type="text" class="form-control" placeholder="邮箱地址" name="Email" value="@Model.studet.Email" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-3">
                    @Html.DropDownList("ClassId", new SelectList(Model.ClassesList, "id", "className"), new { @class = "form-control" })
                </div>

            </div>
            <div class="form-group">
                <div class="col-md-3">

                </div>
                <div class="col-md-8">
                    <input type="button" value="修改信息" id="btnUpdate" class="btn btn-default" />
                </div>
            </div>

        </div>
    </form>
</body>
</html>
